package com.cgnpc.framework.config;


import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/******************************
 * 用途说明: MyBatisPlus相关配置  扫描mapper
 * 作者姓名: pxmwlin
 * 创建时间: 2019/11/20 14:39
 ******************************/

@Configuration
@MapperScan(basePackages = {"com.cgnpc.*.*.mapper","com.cgnpc.cud.*.mapper","com.cgnpc.framework.mapper"})//这个注解，作用相当于下面的@Bean MapperScannerConfigurer，2者配置1份即可
////@ComponentScan(basePackages = {"com.cgnpc.cuddemo"})
public class MybatisPlusConfig {

    /**********************************
    * 用途说明:  开启分页支持
    * 参数说明
    * 返回值说明:
    ***********************************/
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setOverflow(true);// 开启 PageHelper 的支持
        return paginationInterceptor;
    }


//    @Bean
//    public MapperScannerConfigurer mapperScannerConfigurer()
//    {
//        MapperScannerConfigurer mapperScannerConfigurer=new MapperScannerConfigurer();
//        mapperScannerConfigurer.setBasePackage("com.cgnpc.cuddemo.project.*.mapper,com.cgnpc.cud.*.mapper");
//        return mapperScannerConfigurer;
//    }
}
